﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using com.bot.game.shuankou.msg;

public class MainMenuLogic : SQMenuBase
{
    public GameObject _mainMenu;
    public override void OnClick(GameObject btn)
    {
        switch (btn.name)
        {
            case "btnShop":
                UIManager.Instance.popMenu("ShopMenu");
                //unpopMe();
                break;
            case "btnLowRankingHouse":
                UIManager.Instance.popMenu("PlayGameMenu");
                break;
            case "btnSetup":
                UIManager.Instance.popMenu("SetupMenu");
                break;
            case "btnRank":
                UIManager.Instance.popMenu("RankMenu");
                break;
            case "btnActivity":
                UIManager.Instance.popMenu("ActivityMenu");
                break;
            case "btnPlayerInfo":
                Transform playerInfoMenu = _mainMenu.transform.Find("PeopleInfroMenu").transform;
                playerInfoMenu.gameObject.SetActive(true);
                break;
            default:
                break;
        }
    }

    //计算按钮的点击事件
    void OnDrag(GameObject button, Vector2 delta)
    {
        Debug.Log("GameObject " + button.name);
        TweenPosition.Begin(button, 2, new Vector3(button.transform.position.x + 140, button.transform.position.y + 140, 0));
        TweenScale.Begin(button, 2, new Vector3(0.8f,0.8f,1f)); ;
    }
    void onClick(GameObject bt)
    {
        Debug.Log("sbsbsbs");
    }
    public override void onStart()
    {
        base.onStart();

      /*  RollList roll = new RollList();

       GameObject total = _mainMenu.transform.Find("totals").gameObject;

        ItemBase middle = new ItemBase();
 
       List<string> itemList = new List<string>() { "btnHighHouse" , "btnMiddleHouse", "btnLowHouse" };
 
       roll.initRollItem(total, itemList);*/


       // UIEventListener.Get(total).onDrag = OnDrag;


        if (GameManager.Instance.isDebug)
        {
            RegisterAccountC2S data = new RegisterAccountC2S();

            data.name = "caojianhua";

            data.password = "31";

            data.isPhone = true;

            NetDataHandler.Instance.send(18001, NetUtil.serializeProtoObject<RegisterAccountC2S>(data));

        }

    }

}
/*  
   * 
   *  //NotificationCenter.DefaultCenter().PostNotification(this,"a");
      this.postNotification(sdd.a, 2);

   * enum sdd
  {
      a
  }
 void a(Notification e)
{
    Debug.Log("" + (int)e.data);
}*/